<?php
class Control_Gm_chatUserOperation {
	function chatUserOperation() {
		$actionId 	= MooForm::request('actionId');
		$userOperation = MooConfig::get('userOperation.action');
		$actionConf = $userOperation[$actionId];
		$game 	= MooForm::request('game');
		// 聊天监控用户
		$userName = "chat"; 
		$playerId = MooForm::request('playerId');
		
		if(!$playerId) {
			$returnData['code'] = 0;
			$returnData['msg']  = '不能操作管理员';
			$this->OBJ->showMessage($returnData);
		}
		
		$cmd = $actionConf['cmd'];
		
		$params = array();
		if ($cmd == "removemonthcard") {
			$params['playerId'] = $playerId;
		} else {
			$params['playerid'] = $playerId;
		}
		
		if($actionConf['type']) {
			$params['type'] = $actionConf['type'];
		}
		
		// getUrl
		$server 	= MooForm::request('serverUrl');
		$serverLists = MooObj::get('Gm')->getServerListByGame($game);

		if($serverLists) {
			$serverUrl = $serverLists[$server]['url'];
		}
		
		$url = MooObj::get('Gm')->getUrl($serverUrl, $cmd, $userName, $params);
		
		
		$res = MooUtil::curl_send($url);
		$returnData = MooJson::decode($res, true);
		if($returnData['status'] == 1) {
			$returnData['code'] = 1;
			$returnData['msg']  = 'ok';
			$this->OBJ->showMessage($returnData);
		} else {
			$returnData['code'] = 2;
			if($returnData['msg']) {
				$returnData['msg'] = $returnData['msg'];
			} else {
				$returnData['msg']  = '失败';
			}
			$this->OBJ->showMessage($returnData);
		}
		
	}
}